#include <bits/stdc++.h>
using namespace std;

int num[10000] = {0};

int main() {
	int n;
	int ans = 1;
	cin >> n;
	for (int i = 0; i < n; ++i) {
		cin >> num[i];
	}
	for (int i = 0; i < n - 1; ++i) {
		int count = 1;
		for (int j = i; j < n - 1; ++j) {
			if (num[j + 1] - num[j] == 1) {
				count++;
				if (count > ans) {
					ans = count;
				}
			} else {
				if (count > ans) {
					ans = count;
				}
				break;
			}
		}
	}
	cout << ans;
	return 0;
}